//
//  Utility.h
//  Iain Banks
//
//  Created by thohd/Sinbad Flyce on 20/05/2010 - 2012.
//  Copyright 2010 iNIL/ABOM. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "MBProgressHUD.h"
#import <CoreLocation/CoreLocation.h>

#define JGO_TEXT_COLOR_1 ([UIColor colorWithRed:209./255 green:209./255 blue:209./255 alpha:1.0])
#define JGO_FONT_ARIAL_I(x) ([UIFont fontWithName:@"Arial-Italic" size:x])
#define JGO_FONT_ARIAL_B(x) ([UIFont fontWithName:@"Arial-Bold" size:x])
#define JGO_FONT_HELVETICA_B(x) ([UIFont fontWithName:@"Helvetica-Bold" size:x])
#define JGO_FONT_HELVETICA_I(x) ([UIFont fontWithName:@"Helvetica-Italic" size:x])
#define JGO_FONT_HELVETICA(x) ([UIFont fontWithName:@"Helvetica" size:x])

#define JGO_PEOPLE_CHANGED_FILTER      (@"JGO_PEOPLE_CHANGED_FILTER")
#define JGO_PROFILE_RELOAD_AVATAR     (@"JGO_PROFILE_RELOAD_AVATAR")
#define JGO_APP_UPDATE_LOCATION       (@"JGO_APP_UPDATE_LOCATION")
#define JGO_APP_DID_UPDATE_LOCATION   (@"JGO_APP_DID_UPDATE_LOCATION")

@interface Utility : NSObject 

+ (void) showAlert: (NSString*) msg;

@end


@interface JGoUtility : NSObject

//
// Functions
//
+ (CGFloat)widthFromString:(NSString*)aString font:(UIFont*)aFont;
+ (CGFloat)heightFromString:(NSString*)aString font:(UIFont*)aFont;
+ (CGFloat)heightFromString:(NSString*)aString maxWidth:(CGFloat)maxWidth font:(UIFont*)aFont;

+ (BOOL)validateEmail:(NSString *)candidate;

+ (void)showAlert:(NSString*)msg;

+ (MBProgressHUD*)showProgressInView:(UIView*)view target:(id)aTarget 
                               title:(NSString*)titleText selector:(SEL)aSelector;

+ (NSString*)stringFromDate1:(NSDate*)aDate;
+ (NSString*)stringFromDate2:(NSDate*)aDate;
+ (NSString*)stringFromDate3:(NSDate*)aDate;
+ (NSString*)stringFromDate4:(NSDate*)aDate;
+ (NSString*)stringFromDate5:(NSDate*)aDate;
+ (NSString*)stringFromDate6:(NSDate*)aDate;
+ (NSString*)stringFromDate7:(NSDate*)aDate;
+ (NSString*)stringFromArray:(NSArray*)aArrayString;
+ (NSString*)stringForRelationshipStatus:(NSInteger)status;
+ (NSDate*)dateFromString1:(NSString*)stringDate;
+ (NSDate*)dateFromString2:(NSString*)stringDate;
+ (NSDate*)dateFromString3:(NSString*)stringDate;
+ (NSString*)longTimeToShortTime:(NSString*)longTime;
+ (NSString*)distanceString:(NSString*)meterString;
+ (NSInteger)daysBetweenDate:(NSDate*)fromDateTime andDate:(NSDate*)toDateTime;
+ (NSInteger)weekOfYearFromDate:(NSDate*)aDate;

+ (void)setUniversities:(NSArray*)universities;
+ (void)setCourses:(NSArray*)courses;
+ (void)setColleges:(NSArray*)colleges;
+ (void)setModules:(NSArray*)modules;
+ (void)setLocation:(CLLocation*)location;

+ (void)setSharedRootViewController:(UIViewController*)viewController;

+ (UIView*)frontFromView:(UIView*)aView;

// Shared Data
+ (NSMutableDictionary*)sharedCreateAccount;
+ (void)copySharedCreateAccount:(NSDictionary*)aCreateAccount;
+ (NSMutableDictionary*)mutableCopyFromCreateAccount;
+ (NSMutableArray*)sharedUniversities;
+ (NSMutableArray*)sharedCourses;
+ (NSMutableArray*)sharedColleges;
+ (NSMutableArray*)sharedModules;
+ (NSString*)sharedLatitude;
+ (NSString*)sharedLongitude;
+ (NSString*)sharedUCCM;
+ (NSLock*)sharedLock;
+ (NSMutableDictionary*)sharedCachedAvatars;
+ (UIViewController*)sharedRootViewController;

@end